package model

//type ArticleComment struct {
//	ArticleId int    `json:"movie_id"`
//	AuthorId  int    `json:"author_id"`
//	Content   string `json:"content"`
//	ToUid     int    `json:"to_uid"`
//}

type ArticleComment struct {
	Id         int    `json:"id",gorm:"primary_key;AUTO_INCREMENT"`
	CreateTime string `json:"create_time"`
	ModifyTime string `json:"modify_time"`
	Status     int    `json:"status"`

	User      Users `gorm:"foreignkey:UserID;association_foreignkey:ID"`
	UserID    int   `gorm:"not null"`
	ReplyTo   Users `gorm:"foreignkey:ReplyToID;association_foreignkey:ID"`
	ReplyToID int   `sql:"default:null"`
	// 这里没有指定评论对象类型, 直接选择了只对视频评论
	Article   Articles         `gorm:"foreignkey:ArticleID;association_foreignkey:ID"`
	ArticleID int              `gorm:"not null"`
	Parent    *ArticleComment  `gorm:"foreignkey:ParentID;association_foreignkey:ID;"`
	ParentID  int              `sql:"default:null"`
	Root      *ArticleComment  `gorm:"foreignkey:RootID;association_foreignkey:ID;"`
	RootID    int              `sql:"default:null"`
	Content   string           `gorm:"not null"`
	Replys    []ArticleComment `sql:"default:null"`
}

func (ArticleComment) TableName() string {
	return "jk_article_comment"
}
